/* $Id: xml.js,v 1.1.1.1 2014/08/23 06:57:06 ymlam Exp $ Copyright (C) 2014 Link2Tek LLC */

/*
 * This method scapes a string suitable for XML conent
 */
String.prototype.xmlEscape = function()
{
  var x = this;
  x = x.replace(/\&/g, "&amp;");
  x = x.replace(/</g, "&lt;");
  return x;
}

/**
 * returns XML document from string txt
 */
function loadXMLString(txt)
{
  if (window.DOMParser)
  {
    parser=new DOMParser();
    xmlDoc=parser.parseFromString(txt,"text/xml");
  }
  else // Internet Explorer
  {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
    xmlDoc.loadXML(txt);
  }
  return xmlDoc;
}

